import Vue from 'vue'
import VueRouter from 'vue-router'
import axios from 'axios'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/BookAndMovie',
    name: 'BookAndMovie',
    redirect:'BookAndMovie/movie',
    component: () => import('../views/BookAndMovie.vue'),
    children:[
      {
        path:'/BookAndMovie/movie',
        name:'movie',
        component:()=>import('../components/Movie.vue'),
        meta:{
          title:'BookAndMovie'
        }
      },
      {
        path:'/BookAndMovie/book',
        name:'book',
        component:()=>import('../components/Book.vue'),
        meta:{
          title:'BookAndMovie'
        }
      },
      {
        path:'/BookAndMovie/tv',
        name:'tv',
        component:()=>import('../views/Tv.vue'),
        meta:{
          title:'BookAndMovie'
        }
      },
      {
        path:'/BookAndMovie/samecity',
        name:'samecity',
        component:()=>import('../views/SameCity.vue'),
        meta:{
          title:'BookAndMovie'
        }
      },
      {
        path:'/BookAndMovie/music',
        name:'music',
        component:()=>import('../views/Music.vue'),
        meta:{
          title:'BookAndMovie'
        }
      }
    ]
  },
  {
    path: '/broadcast',
    name: 'broadcast',
    component: () => import('../views/Broadcast.vue')
  },
  {
    path: '/group',
    name: 'group',
    component: () => import('../views/Group.vue')
  },
  {
    path: '/my',
    name: 'my',
    component: () => import('../views/My.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
  return originalPush.call(this, location).catch(err => { })
};

export default router
